arr = ["Robin","Owl","Sparrow","Nightingale","Pigeon","Crow","Raven"] |
print(arr[4]) |
print(arr[0]) |
1 | arr = ["Robin","Owl","Sparrow","Nightingale","Pigeon","Crow","Raven"] |
2 | print(arr[0]) |
3 | print(arr[4]) |
arr.append(i) |
j = input() |
i = input() |
print(arr) |
arr.append(j) |
arr = [] |
print("Enter two inputs") |
1 | arr = [] |
2 | print("Enter two inputs") |
3 | i = input() |
4 | j = input() |
5 | arr.append(i) |
6 | arr.append(j) |
7 | print(arr) |
arr = [1,2,3,4,5] |
print(len(arr)) |
1 | arr = [1,2,3,4,5] |
2 | print(len(arr)) |
arr = [6,10] |
a = arr[0] |
print(a + b) |
b = arr[1] |
1 | arr = [6,10] |
2 | a = arr[0] |
3 | b = arr[1] |
4 | print(a + b) |
print(cities[x]) |
for x in range(l): |
cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
l = len(cities) |
    print(cities[x]) |
for x in range(l): |
cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
l = len(cities) |
1 | cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
2 | l = len(cities) |
3 | for x in range(l): |
4 |     print(cities[x]) |
5 |      |
print(cities[x] + "!") |
l = len(cities) |
cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
for x in range(l): |
    print(cities[x] + "!") |
l = len(cities) |
cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
for x in range(l): |
1 | cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
2 | l = len(cities) |
3 | for x in range(l): |
4 |     print(cities[x] + "!") |
l = len(arr) |
for x in range(l): |
print(arr[x] * 2) |
arr = [5,4,3,1,9,8,2] |
l = len(arr) |
for x in range(l): |
    print(arr[x] * 2) |
arr = [5,4,3,1,9,8,2] |
1 | arr = [5,4,3,1,9,8,2] |
2 | l = len(arr) |
3 | for x in range(l): |
4 |     print(arr[x] * 2) |
arr = [5,4,3,1,9,8,2] |
for x in range(l): |
l = len(arr) |
print(arr[x]) |
if arr[x] > 5: |
arr = [5,4,3,1,9,8,2] |
for x in range(l): |
l = len(arr) |
        print(arr[x]) |
    if arr[x] > 5: |
1 | arr = [5,4,3,1,9,8,2] |
2 | l = len(arr) |
3 | for x in range(l): |
4 |     if arr[x] > 5: |
5 |         print(arr[x]) |
6 |      |
t = t + arr[x] |
t = 0 |
arr = [5,4,3,1,9,8,2] |
print(t) |
for x in range(l): |
l = len(arr) |
    t = t + arr[x] |
t = 0 |
arr = [5,4,3,1,9,8,2] |
print(t) |
for x in range(l): |
l = len(arr) |
1 | arr = [5,4,3,1,9,8,2] |
2 | t = 0 |
3 | l = len(arr) |
4 | for x in range(l): |
5 |     t = t + arr[x] |
6 | print(t) |
r = random.randint(1,100) |
arr.append(r) |
print(arr) |
for x in range(30): |
import random |
arr = [] |
    r = random.randint(1,100) |
    arr.append(r) |
print(arr) |
for x in range(30): |
import random |
arr = [] |
1 | import random |
2 | |
3 | arr = [] |
4 | for x in range(30): |
5 |     r = random.randint(1,100) |
6 |     arr.append(r) |
7 | print(arr) |
i = input() |
arr.append(i*j) |
arr = [] |
i = int(i) |
j = input() |
arr.append(j) |
j = int(j) |
arr.append(i) |
print("Enter two numbers") |
1 | arr = [] |
2 | print("Enter two numbers") |
3 | i = input() |
4 | i = int(i) |
5 | j = input() |
6 | j = int(j) |
7 | arr.append(i) |
8 | arr.append(j) |
9 | arr.append(i*j) |
b = str(arr[x+1]) |
print("Current: " + a + " Next: " + b) |
for x in range(l): |
a = str(arr[x]) |
arr = [5,4,3,1,9,8,2] |
l = len(arr) - 1 #The last index won't have a "next" so will error |
    b = str(arr[x+1]) |
    print("Current: " + a + " Next: " + b) |
for x in range(l): |
    a = str(arr[x]) |
arr = [5,4,3,1,9,8,2] |
l = len(arr) - 1 #The last index won't have a "next" so will error |
1 | arr = [5,4,3,1,9,8,2] |
2 | l = len(arr) - 1 #The last index won't have a "next" so will error |
3 | for x in range(l): |
4 |     a = str(arr[x]) |
5 |     b = str(arr[x+1]) |
6 |     print("Current: " + a + " Next: " + b) |
print(a + " + " + b + " = " + c) |
b = str(arr[x+1]) |
for x in range(l): |
c = str(arr[x] + arr[x+1]) |
l = len(arr) - 1 #The last index won't have a "next" so will error |
a = str(arr[x]) |
arr = [5,4,3,1,9,8,2] |
    print(a + " + " + b + " = " + c) |
    b = str(arr[x+1]) |
for x in range(l): |
    c = str(arr[x] + arr[x+1]) |
l = len(arr) - 1 #The last index won't have a "next" so will error |
    a = str(arr[x]) |
arr = [5,4,3,1,9,8,2] |
1 | arr = [5,4,3,1,9,8,2] |
2 | l = len(arr) - 1 #The last index won't have a "next" so will error |
3 | for x in range(l): |
4 |     a = str(arr[x]) |
5 |     b = str(arr[x+1]) |
6 |     c = str(arr[x] + arr[x+1]) |
7 |     print(a + " + " + b + " = " + c) |
print(arr[i]) |
l = len(arr) |
for x in range(l): |
arr = [5,4,3,1,9,8,2] |
i = l - 1 - x |
    print(arr[i]) |
l = len(arr) |
for x in range(l): |
arr = [5,4,3,1,9,8,2] |
    i = l - 1 - x |
1 | arr = [5,4,3,1,9,8,2] |
2 | l = len(arr) |
3 | for x in range(l): |
4 |     i = l - 1 - x |
5 |     print(arr[i]) |
print("Enter a number to search for") |
found = False |
l = len(arr) |
found = True |
i = int(i) |
arr = [5,4,3,1,9,8,2] |
if arr[x] == i: |
break |
else: |
i = input() |
print("Item Found") |
for x in range(l): |
if found == True: |
print("Item not found") |
print("Enter a number to search for") |
found = False |
l = len(arr) |
        found = True |
i = int(i) |
arr = [5,4,3,1,9,8,2] |
    if arr[x] == i: |
        break |
else: |
i = input() |
    print("Item Found") |
for x in range(l): |
if found == True: |
    print("Item not found") |
1 | arr = [5,4,3,1,9,8,2] |
2 | print("Enter a number to search for") |
3 | i = input() |
4 | i = int(i) |
5 | |
6 | l = len(arr) |
7 | found = False |
8 | |
9 | for x in range(l): |
10 |     if arr[x] == i: |
11 |         found = True |
12 |         break |
13 | if found == True: |
14 |     print("Item Found") |
15 | else: |
16 |     print("Item not found") |
print(s) |
s = s + cities[x] |
cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
s = s + cities[x] + ", " |
if x != l - 1: |
else: |
l = len(cities) |
s = "" |
for x in range(l): |
print(s) |
        s = s + cities[x] |
cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
        s = s + cities[x] + ", " |
    if x != l - 1: |
    else: |
l = len(cities) |
s = "" |
for x in range(l): |
1 | cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
2 | l = len(cities) |
3 | s = "" |
4 | for x in range(l): |
5 |     if x != l - 1: |
6 |         s = s + cities[x] + ", " |
7 |     else: |
8 |         s = s + cities[x] |
9 | print(s) |
print(a[:i]) |
for x in range(l): |
i = len(a) // 2 |
cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
a = cities[x] |
l = len(cities) |
    print(a[:i]) |
for x in range(l): |
    i = len(a) // 2 |
cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
    a = cities[x] |
l = len(cities) |
1 | cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
2 | l = len(cities) |
3 | for x in range(l): |
4 |     a = cities[x] |
5 |     i = len(a) // 2 |
6 |     print(a[:i]) |
cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
print(cities[x][y]) |
for y in range(len(cities[x])): |
for x in range(len(cities)): |
cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
        print(cities[x][y]) |
    for y in range(len(cities[x])): |
for x in range(len(cities)): |
1 | cities = ["London","Birmingham","Manchester","Bristol","Bath"] |
2 | for x in range(len(cities)): |
3 |     for y in range(len(cities[x])): |
4 |         print(cities[x][y]) |
w = arr[x*2 + 1] |
import colored |
c = arr[x*2] |
l = len(arr)//2 |
print(colored.fg(c) + w) |
arr = ["red","R","green","G","blue","B"] |
for x in range(l): |
    w = arr[x*2 + 1] |
import colored |
    c = arr[x*2] |
l = len(arr)//2 |
    print(colored.fg(c) + w) |
arr = ["red","R","green","G","blue","B"] |
for x in range(l): |
1 | import colored |
2 | arr = ["red","R","green","G","blue","B"] |
3 | l = len(arr)//2 |
4 | for x in range(l): |
5 |     c = arr[x*2] |
6 |     w = arr[x*2 + 1] |
7 |     print(colored.fg(c) + w) |
8 |      |
if s[x] == ",": |
for x in range(len(s)): |
t = "" |
t = t + s[x] |
s = s + "," #To ensure the last item is added |
t = "" |
arr.append(t) |
arr = [] |
print(arr) |
else: |
s = "Hello,this,is,a,test" |
    if s[x] == ",": |
for x in range(len(s)): |
        t = "" |
        t = t + s[x] |
s = s + "," #To ensure the last item is added |
t = "" |
        arr.append(t) |
arr = [] |
print(arr) |
    else: |
s = "Hello,this,is,a,test" |
1 | s = "Hello,this,is,a,test" |
2 | s = s + "," #To ensure the last item is added |
3 | arr = [] |
4 | t = "" |
5 | for x in range(len(s)): |
6 |     if s[x] == ",": |
7 |         arr.append(t) |
8 |         t = "" |
9 |     else: |
10 |         t = t + s[x] |
11 | print(arr) |
alpha = "abcdefghijklmnopqrstuvwxyz" |
s = "hello this is a test" |
print(alpha[x] + ":" + str(t)) |
t = t + 1 |
for x in range(len(alpha)): |
t = 0 |
if t > 0: |
for y in range(len(s)): |
if s[y].lower() == alpha[x]: |
alpha = "abcdefghijklmnopqrstuvwxyz" |
s = "hello this is a test" |
        print(alpha[x] + ":" + str(t)) |
            t = t + 1 |
for x in range(len(alpha)): |
    t = 0 |
    if t > 0: |
    for y in range(len(s)): |
        if s[y].lower() == alpha[x]: |
1 | alpha = "abcdefghijklmnopqrstuvwxyz" |
2 | s = "hello this is a test" |
3 | for x in range(len(alpha)): |
4 |     t = 0 |
5 |     for y in range(len(s)): |
6 |         if s[y].lower() == alpha[x]: |
7 |             t = t + 1 |
8 |     if t > 0: |
9 |         print(alpha[x] + ":" + str(t)) |
s = s + arr[y][x] |
for x in range(4): |
for y in range(len(arr)): |
arr = ["rtsm","ehhe","aeet","crea","hepl"] |
print(s) |
s = "" |
        s = s + arr[y][x] |
for x in range(4): |
    for y in range(len(arr)): |
arr = ["rtsm","ehhe","aeet","crea","hepl"] |
    print(s) |
    s = "" |
1 | arr = ["rtsm","ehhe","aeet","crea","hepl"] |
2 | |
3 | for x in range(4): |
4 |     s = "" |
5 |     for y in range(len(arr)): |
6 |         s = s + arr[y][x] |
7 |     print(s) |
8 |      |
for x in range(len(arr[0])): |
i = "Occur Press Offer" |
arr = i.lower().split(" ") |
arr2.append(s) |
arr2 =[] |
s = s + arr[y][x] |
for y in range(len(arr)): |
print(arr2) |
s = "" |
for x in range(len(arr[0])): |
i = "Occur Press Offer" |
arr = i.lower().split(" ") |
    arr2.append(s) |
arr2 =[] |
        s = s + arr[y][x] |
    for y in range(len(arr)): |
print(arr2) |
    s = "" |
1 | i = "Occur Press Offer" |
2 | arr = i.lower().split(" ") |
3 | arr2 =[] |
4 | for x in range(len(arr[0])): |
5 |     s = "" |
6 |     for y in range(len(arr)): |
7 |         s = s + arr[y][x] |
8 |     arr2.append(s) |
9 | print(arr2) |